package org.geektimes.web.mvc.servlet;

import org.geektimes.web.mvc.FrontControllerServlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

/**
 * @author :   chuan
 * @date :   2021/03/23
 */
public class MyServletInitializer implements MyWebMvcInitializer{

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {

        ServletRegistration.Dynamic servletRegistration =
                servletContext.addServlet(FrontControllerServlet.class.getSimpleName(), new FrontControllerServlet(servletContext));
        servletRegistration.setLoadOnStartup(1);
        servletRegistration.addMapping("/");

        System.out.println(this.getClass().getSimpleName() + "--------Load Success-------->");

    }
}
